\bigskip
\bigskip
{\magonebf 3.2 Two Dimensional Arrays (array2)}

\decl array2 E 

{\bf 1. Definition}

An instance $A$ of the parameterized data type \name\ is a mapping from a 
set of pairs $I = [a..b] \times [c..d]$, called the index set of $A$, to the 
set of variables of data type $E$, called the element type of $A$, for two 
fixed intervals of integers $[a..b]$ and $[b..c]$.  $A(i,j)$ is called the 
element at position $(i,j)$. 

\bigskip
{\bf 2. Creation}

\create A (a,b,c,d)

creates an instance \var\ of type \name\ with index set $[a..b]\times [c..d]$.


\bigskip
{\bf 3. Operations}
\cleartabs
\+&\hskip 1.5truecm &\hskip 6truecm &\cr
\+\opf E\&  {int\ i,\ int\ j}           
                            {returns $A(i,j)$. }
\+\nop                      {\precond $a\le i\le b$ and $c\le j\le d$. }
\smallskip
\+\op  int  low1  {}        
                            {returns $a$}
\smallskip
\+\op  int  high1 {}        
                            {returns $b$}
\smallskip
\+\op  int  low2  {}        
                            {returns $c$}
\smallskip
\+\op  int  high2 {}        
                            {returns $d$}
\smallskip


\bigskip
{\bf 4. Implementation}

Two dimensional arrays are implemented by \CC vectors. All operations
take time $O(1)$, the space requirement is $O(|I|)$.


